package com.voltmao.webpro.utils.wechat.utils.dto.msg.response;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017/2/7.
 */
public class SendNewsMsg {

    private int ArticleCount;              //图文消息数量
    private List<SendNews> Articles;       //图文消息内容
    private String ToUserName;             //接收方帐号（收到的OpenID）

    /**
     * @param toUserName
     * @param fromUserName
     * @param createTime
     */
    public SendNewsMsg(String toUserName, String fromUserName, String createTime) {
        ToUserName = toUserName;
        FromUserName = fromUserName;
        CreateTime = createTime;
    }

    public SendNewsMsg() {

    }

    private String FromUserName;           //开发者微信号
    private String CreateTime;             //消息创建时间 （整型）
    private String MsgType;                //news

    private ArrayList<SendNews> sendNewsList = new ArrayList<>();

    /**
     * 提供添加消息内容方法
     *
     * @param Title
     * @param Description
     * @param PicUrl
     * @param Url
     * @return
     */
    public List<SendNews> addArticles(String Title, String Description, String PicUrl, String Url) {
        sendNewsList.add(new SendNews(Title, Description, PicUrl, Url));
        setArticles(sendNewsList);
        setArticleCount(sendNewsList.size());
        return sendNewsList;
    }

    public String getToUserName() {
        return ToUserName;
    }

    public void setToUserName(String toUserName) {
        ToUserName = toUserName;
    }

    public String getFromUserName() {
        return FromUserName;
    }

    public void setFromUserName(String fromUserName) {
        FromUserName = fromUserName;
    }

    public String getCreateTime() {
        return CreateTime;
    }

    public void setCreateTime(String createTime) {
        CreateTime = createTime;
    }

    public String getMsgType() {
        return MsgType;
    }

    public void setMsgType(String msgType) {
        MsgType = msgType;
    }

    public int getArticleCount() {
        return ArticleCount;
    }

    public void setArticleCount(int articleCount) {
        ArticleCount = articleCount;
    }

    public List<SendNews> getArticles() {
        return Articles;
    }

    public void setArticles(List<SendNews> articles) {
        Articles = articles;
    }

    public List<SendNews> addArticles(ArticleItemMsg subscribeMsg) {
        sendNewsList.add(new SendNews(subscribeMsg.getTitle(), subscribeMsg.getDes(), subscribeMsg.getPicurl(), subscribeMsg.getUrl()));
        setArticles(sendNewsList);
        setArticleCount(sendNewsList.size());
        return sendNewsList;

    }
}
